<template>
  <button @click="count++">Add 1</button>
  <p>Count is: {{ count }}</p>
  <!-- `greet` 是上面定义过的方法名 -->
  <button @click="greet">Greet</button>
</template>

<script setup>
import { ref, reactive, computed } from "vue";
//内联事件处理器
const count = ref(0);

//方法事件处理器
const name = ref("Vue.js");

function greet(event) {
  console.info(`Hello ${name.value}!`);
  // `event` 是 DOM 原生事件
  if (event) {
    console.info(event.target.tagName);
  }
}
</script>
